home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 111 / PC Guia 111.iso / Software / Utils / NetObjects Fusion 7.0 / NOF7Trial.exe / data1.cab / Fsi_-_English / Update / Update.js < prev   
Text File  |  2002-06-12  |  2KB  |  46 lines

  1. function update()
  2. {
  3.     var app = new ActiveXObject('FSI.FSIApplication');
  4.     var app2 = new ActiveXObject('FSI.FSIApplication2');
  5.     var versionString = app.GetRegistryString(true, 'Version');
  6.     versionString = versionString.split('.');
  7.     var version = versionString[0];
  8.     var versionInfo = app.GetRegistryString(true, 'VersionInfo');
  9.     var thePath = app.AppDirectory + 'FSIUpdater\\Updater.zip'
  10.  
  11.     if (app.CurrentUpdater < app.LatestUpdater)
  12.     {
  13.         app.OpenProgressDialog('Updating', 'Getting updater file information...', 0, 0, true);
  14.         result = updateUpdater(app, thePath, version, versionInfo);
  15.         app.CloseProgressDialog(0);
  16.         if (!result)
  17.         {
  18.             app.DeleteTempDir();
  19.             window.showModalDialog("../InitFusion/UpdateIncomplete.html", 0,
  20.                 "status:no;help:no;border:thin;dialogWidth:205px;dialogHeight:110px;center:yes;scroll:no;");
  21.             return false;
  22.         }
  23.     }
  24.  
  25.     app2.ExtractZipFile(thePath, app.GetTempDir());
  26.     app.RunFSI(app.GetTempDir() + '\\Update.html', 'run()');
  27.     var result = app.GetInstVar('update');
  28.  
  29.     return result;
  30.  
  31. function updateUpdater(app, localPath, version, versionInfo)
  32. {
  33.     var request = 'Application=Fusion&Version=' + version + '&VersionInfo=' + versionInfo + '&Type=UpdaterUpdate';
  34.     var response = app.HttpRequest('http://www.netobjects.com/update/UpdateFile.cgi', '', request, false, false, true);
  35.     if (!response.length)
  36.         return false;
  37.  
  38.     app.SetProgressMessage('Downloading updater file...');
  39.  
  40.     if (!app.HttpDownload(response, '', '', true, localPath, true))
  41.         return false;
  42.     
  43.     app.CurrentUpdater = app.LatestUpdater;
  44.     return true;
  45. }